/**
 * 购物车
 */
const { router, libQuery } = require('../../lib/route')
const pathJoin = require('../common-api/data-path')

const dataPath = pathJoin('category')

libQuery((req, res, next, method) => {
  // console.log('req=', req)

  // const headers = req.headers || {}
  // let host = headers.host || '/'
  // host = 'http://' + host

  const cookies = req.cookies || ''
  console.log('cookies=', cookies)

  const data = require(dataPath)
  if (data) {
    res.send(JSON.stringify(data))
  } else {
    res.renderError('没有找到 ' + dataPath)
  }
}, '/cart')

module.exports = router